package mnnu.ghbe.controller;

import mnnu.ghbe.entity.Event;
import mnnu.ghbe.service.EventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/event")
public class EventController {
    
    @Autowired
    private EventService eventService;
    
    @GetMapping
    public List<Event> getEventsByRiskLevel(@RequestParam Integer riskLevel) {
        return eventService.getEventsByRiskLevel(riskLevel);
    }
}